//
//  FAQSourchView.m
//  DanKU
//
//  Created by 吴斌 on 2023/11/11.
//

#import "FAQSourchView.h"
@interface FAQSourchView()
@property (nonatomic, strong)UITextField * faqSourchTexField;
@end
@implementation FAQSourchView
-(instancetype)init{
    if(self == [super init]){
        self.backgroundColor = UIColor.clearColor;
        self.layer.borderColor = DK_Hex(@"#B6B6B6").CGColor;
        self.layer.borderWidth = DK_IsWidthScale(1);
        self.layer.cornerRadius = DK_IsWidthScale(25);
        self.clipsToBounds = YES;
        [self dk_addSubView];
    }
    return self;
}
- (void)dk_addSubView{
    self.faqSourchTexField = [[UITextField alloc] init];
    self.faqSourchTexField.textColor = DK_Hex(@"#1D1D1D");
    self.faqSourchTexField.font = DK_FONT_Bold(13);
    self.faqSourchTexField.placeholder = @"Search questions";
    [self addSubview:self.faqSourchTexField];
    [self.faqSourchTexField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(DK_IsWidthScale(26)));
        make.right.equalTo(@(-DK_IsWidthScale(72)));
        make.top.equalTo(@(DK_IsWidthScale(0)));
        make.bottom.equalTo(@(DK_IsWidthScale(0)));
    }];
    UIButton * faqSourchBtn = [[UIButton alloc] init];
    [faqSourchBtn setBackgroundImage:DK_GetImage(@"dk_MeFaq_Sourch") forState:UIControlStateNormal];
    [faqSourchBtn addTarget:self action:@selector(faqSourch) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:faqSourchBtn];
    [faqSourchBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self);
        make.right.equalTo(@(-DK_IsWidthScale(23)));
        make.width.equalTo(@(DK_IsWidthScale(23)));
        make.height.equalTo(@(DK_IsWidthScale(23)));
    }];
}
- (void)faqSourch{
    if(self.faqSourchTexField.text.length){
        if(self.FaqSourchBlock){
            self.FaqSourchBlock(self.faqSourchTexField.text);
        }
    }
}
@end
